package mynote;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

//数据库连接相关类
public class MyDB {
    public static String driver = "com.mysql.cj.jdbc.Driver";
    public static String url =
            "jdbc:mysql://localhost:3306/Users_Info?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC";
    public static String userDB = "root";
    public static String pwdDB = "1236584369369a";

    //关闭数据库连接
    public static void closeDB(Connection con, Statement st, ResultSet res)  {
        try {
            if(res !=null)
                res.close();
            if(st !=null)
                st.close();
            if(con !=null)
                con.close();
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
}
